package tools;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.google.common.collect.Lists;

import cn.hutool.core.io.FileUtil;

public class HtmlBcgm2Text {
	
	public static void main(String[] args) throws IOException {
		
		 
		File file = new File("F:/zongyicd/yao.txt");
		PrintWriter wirter = FileUtil.getPrintWriter(file, "GBK", true);
		 
		Document document = Jsoup.parse(new File("F:/szyz/中医宝典/zybd/中医书籍大全/本草书籍/本草纲目/00.htm"), "GBK");
		Elements title = document.select("ul[class=\"L0\"]").select("li");
		Iterator<Element> iter = title.iterator();
		while(iter.hasNext()){
			Element tt = iter.next();
			System.out.println(tt.text());
			wirter.append(tt.text());
			wirter.append("\n"); 
		} 
		 
		wirter.close();
		
	}
} 